{extend name="page_base" /} {block name="seo"}
<title>申请收录 - {$site_config['seo_title']}</title>
<meta name="keywords" content="{$site_config['seo_keyword']}">
<meta name="description" content="{$site_config['seo_description']}">
{/block}
{block name="css"}
{/block}
{block name="body"}
<div class="page page-current">
    <div class="content native-scroll">
        <header id="header" class="clearfix theader">
            <a href="/" class="back iconfont icon-fanhui"></a>
            <h3 class="titlea">酷站收录</h3>
        </header>
        <div class="thisContent layui-clear">
            <form class="send layui-form" id="save_form"  onsubmit="return false">
                <input type="text" name="name" lay-verify="min_2" maxlength="20" placeholder="网站标题"
                       />
                <input type="text" name="link" lay-verify="link" placeholder="网站域名以http(s)://开头"
                       />

                <textarea name="remake" lay-verify="min_10_max_300" placeholder="您想给站长说的话"
                          style="margin-top:20px;height:100px;float:left;"></textarea>
                <input type="text" name="qq" lay-verify="min_2" maxlength="11" placeholder="您的QQ号"/>
                <input name="captcha" lay-verify="required" maxlength="4" type="text" placeholder="验证码" style="margin:0;float:left;width:calc(100% - 144px);">

                <img src="{:url('index/page/captcha')}?'+Math.random();" id="img_code" title="点击可刷新图形码" style="width:144px;height:2rem;" onclick="this.src='{:url(\'index/page/captcha\')}?_='+Math.random()"/>

                <input type="submit" value="提 交" class="btn save_btn"
                       style="margin-top:30px;"/>
            </form>
            <div class="tj">
                收录条件：<br/>
                1、百度权重{$site_config['apply_friendly_baidu_pr']}以上<br/>
                2、正规网站，不违反中国法律的<br/>
                3、网站内容必须完善，不能是新网站<br/>
            </div>
        </div>
        {include file="index/footer"}
    </div>
</div>
{/block}
{block name="script"}
<script>
    $(".save_btn").click(function () {

        var form_obj = $("#save_form");
        var data = form_obj.field();
        var reg_url = /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;
        var reg_qq =  /^[1-9]([0-9]{5,11})$/;
        var ck_sub = form_obj.verify({

            name: function (value, item) {
                if (value.length < 3 || value.length > 20) {
                    return '请输入3到20位字符';
                }
            },
            link: function (value, item) {
                if (!reg_url.test(value)) {
                    return '小可爱，网址不正确哦,(带上http或者https)';
                }
            },
            qq: function (value, item) {
                if (!reg_qq.test(value)) {
                    return 'QQ格式不正确！';
                }
            },
            captcha:function (value, item) {
                if (value.length != 4) {
                    return '验证码长度是4位哦！';
                }
            }

        })

        if(ck_sub){
            $.ajax({
                type: "Post",
                url:'/about/send.html',
                data:{
                    data:data,
                    post_type:'add_apply'
                },
                dataType: "json",
                success: function(res){
                    $("#img_code").click();
                    $("#img_code").trigger("click");
                    $.alert(res.msg, function () {
                        (res.code === 1) && location.reload();
                    });

                }
            });
        }
    })

</script>
{/block}